<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
	<html>
	<body>
				<div id="_ctp_mainframe_menu" class="menu-body" onclick="menuShow(event)">
					<!--P-->
						<ul>
							<xsl:apply-templates select="ROOT/TOPICLIST/TOPICS"
								mode="parentmode" />
						</ul>
					<!--/P-->
				</div>
	</body>		
	</html>	
	</xsl:template>
	<xsl:template match="TOPICS" mode="childrenmodelvl4">
		<LI CLASS="L41">
			<xsl:attribute name="id">
				<xsl:value-of select="ID" />
			</xsl:attribute>
			<a ondrag="return false;" href="#@" hidefocus="true">
				<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>				
				<xsl:value-of select="URLT" />
					<xsl:if test="position()=last()">
						<span class="l-minus" node="last">
							<span class="icon-open" node="icon">
							</span>
							<xsl:value-of select="@TYPE" />
						</span>
					</xsl:if>
					<xsl:if test="not(position()=last())">
						<span class="t-minus">
							<span class="icon-open" node="icon">
							</span>
							<xsl:value-of select="@TYPE" />
						</span>
					</xsl:if>
			</a>
			<UL>
				<xsl:if test="not(position()=last())">
					<xsl:attribute name="class">collapsed-4</xsl:attribute>
				</xsl:if>
				<xsl:for-each select="TOPIC">
					<LI class="L5">
						<xsl:attribute name="id">
					       	<xsl:value-of select="ID" />
					    </xsl:attribute>
						<A ondrag="return false;" href="#@" hidefocus="true">
							<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>
							<xsl:attribute name="ONCLICK">
							if(genId.current){
							    document.getElementById(genId.current).className=document.getElementById(genId.current).className.replace(" ctp-leftmenu-visited","");												   
							    }
						 	    var selected= this.firstChild;
								selected.className+=" ctp-leftmenu-visited";
								if(!selected.id){
							    selected.id="L"+(genId.L_node++).toString();
							    genId.current=selected.id;
								}else{
								genId.current=selected.id;
								}
								<xsl:value-of select="URLT" />
					        </xsl:attribute>
							<xsl:if test="position()=last()">
								<span class="line2">　
									<span class="icon-fn">　
									</span>
									<xsl:value-of select="TITLE" />
								</span>
							</xsl:if>
							<xsl:if test="not(position()=last())">
								<span class="line3">　
									<span class="icon-fn">　
									</span>
									<xsl:value-of select="TITLE" />
								</span>
							</xsl:if>
						</A>
					</LI>
				</xsl:for-each>
				<xsl:if test="TOPICS">
					<xsl:apply-templates select="TOPICS" mode="childrenmodelvl4" />
				</xsl:if>
			</UL>
		</LI>
	</xsl:template>
	
	<xsl:template match="TOPICS" mode="childrenmodelvl3">
		<LI CLASS="L31">
			<xsl:attribute name="id">
				<xsl:value-of select="ID" />
			</xsl:attribute>
			<a ondrag="return false;" href="#@" hidefocus="true">
				<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>				
				<xsl:value-of select="URLT" />
					<xsl:if test="position()=last()">
						<span class="l-minus" node="last">
							<span class="icon-open" node="icon">
							</span>
							<xsl:value-of select="@TYPE" />
						</span>
					</xsl:if>
					<xsl:if test="not(position()=last())">
						<span class="t-minus">
							<span class="icon-open" node="icon">
							</span>
							<xsl:value-of select="@TYPE" />
						</span>
					</xsl:if>
			</a>
			<UL>
				<xsl:if test="not(position()=last())">
					<xsl:attribute name="class">collapsed-3</xsl:attribute>
				</xsl:if>
				<xsl:variable name="topicsNum3" select="count(TOPICS)" />
				<xsl:for-each select="TOPIC">
					<LI class="L4">
						<xsl:attribute name="id">
					       	<xsl:value-of select="ID" />
					    </xsl:attribute>
						<A ondrag="return false;" href="#@" hidefocus="true">
							<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>
							<xsl:attribute name="ONCLICK">
							if(genId.current){
							    document.getElementById(genId.current).className=document.getElementById(genId.current).className.replace(" ctp-leftmenu-visited","");												   
							    }
						 	    var selected= this.firstChild;
								selected.className+=" ctp-leftmenu-visited";
								if(!selected.id){
							    selected.id="L"+(genId.L_node++).toString();
							    genId.current=selected.id;
								}else{
								genId.current=selected.id;
								}
								<xsl:value-of select="URLT" />
					        </xsl:attribute>
							<xsl:if test="position()=last()">
								<xsl:if test="$topicsNum3=0">
									<span class="line2">　
										<span class="icon-fn">　
										</span>
										<xsl:value-of select="TITLE" />
									</span>
								</xsl:if>
								<xsl:if test="$topicsNum3!=0">
									<span class="line3">　
										<span class="icon-fn">　
										</span>
										<xsl:value-of select="TITLE" />
									</span>
								</xsl:if>
							</xsl:if>
							<xsl:if test="not(position()=last())">
								<span class="line3">　
									<span class="icon-fn">　
									</span>
									<xsl:value-of select="TITLE" />
								</span>
							</xsl:if>
						</A>
					</LI>
				</xsl:for-each>
				<xsl:if test="TOPICS">
					<xsl:apply-templates select="TOPICS" mode="childrenmodelvl4" />
				</xsl:if>
			</UL>
		</LI>
	</xsl:template>


	<xsl:template match="TOPICS" mode="childrenmode">
		<LI CLASS="L21">
			<xsl:attribute name="id">
				<xsl:value-of select="ID" />
			</xsl:attribute>
			<a ondrag="return false;" href="#@" hidefocus="true">	
				<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>			
				<xsl:value-of select="URLT" />
					<xsl:if test="position()=last()">
						<span class="l-minus" node="last">
							<span class="icon-open" node="icon">
							</span>
							<xsl:value-of select="@TYPE" />
						</span>
					</xsl:if>
					<xsl:if test="not(position()=last())">
						<span class="t-minus">
							<span class="icon-open" node="icon">
							</span>
							<xsl:value-of select="@TYPE" />
						</span>
					</xsl:if>
			</a>
			<UL>
				<xsl:if test="not(position()=last())">
					<xsl:attribute name="class">collapsed-2</xsl:attribute>
				</xsl:if>
				<xsl:variable name="topicsNum2" select="count(TOPICS)" />
				<xsl:for-each select="TOPIC">
					<LI class="L3">
						<xsl:attribute name="id">
					       	<xsl:value-of select="ID" />
					    </xsl:attribute>
						<A ondrag="return false;" href="#@" hidefocus="true">
							<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>
							<xsl:attribute name="ONCLICK">
							if(genId.current){
							    document.getElementById(genId.current).className=document.getElementById(genId.current).className.replace(" ctp-leftmenu-visited","");												   
							    }
						 	    var selected= this.firstChild;
								selected.className+=" ctp-leftmenu-visited";
								if(!selected.id){
							    selected.id="L"+(genId.L_node++).toString();
							    genId.current=selected.id;
								}else{
								genId.current=selected.id;
								}
								<xsl:value-of select="URLT" />
					        </xsl:attribute>
							<xsl:if test="position()=last()">
								<xsl:if test="$topicsNum2=0">
									<span class="line2">　
										<span class="icon-fn">　
										</span>
										<span class="bg_color"><xsl:value-of select="TITLE" /></span>
									</span>
								</xsl:if>
								<xsl:if test="$topicsNum2!=0">
									<span class="line3">　
										<span class="icon-fn">　
										</span>
										<span class="bg_color"><xsl:value-of select="TITLE" /></span>
									</span>
								</xsl:if>
							</xsl:if>
							<xsl:if test="not(position()=last())">
								<span class="line3">　
									<span class="icon-fn">　
									</span>
									<span class="bg_color"><xsl:value-of select="TITLE" /></span>
								</span>
							</xsl:if>
						</A>
					</LI>
				</xsl:for-each>
				<xsl:if test="TOPICS">
					<xsl:apply-templates select="TOPICS" mode="childrenmodelvl3" />
				</xsl:if>
			</UL>
		</LI>
	</xsl:template>

	<xsl:template match="TOPICS" mode="parentmode">
		<xsl:variable name="temp">
			<xsl:value-of select="@TYPE" />
		</xsl:variable>
		<LI CLASS="L1">
			<xsl:if test="$temp='快捷菜单'or $temp='Shortcut menu'">
				<xsl:attribute name="id">Shortcut_menu</xsl:attribute>
				<xsl:attribute name="style">display:none</xsl:attribute>
			</xsl:if>
			<A style="font-weight:bold" ondrag="return false;" href="#@" hidefocus="true">
					<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>
					<xsl:if test="position()=last()">
						<!--
							<img src="../images/menu/l_minus.gif" align="absMiddle"
							node="last" />
						-->
						<span class="l-minus" node="last">
						<span class="icon-open" node="icon"></span>
						<xsl:value-of select="$temp" />
						</span>
						</xsl:if>
						<xsl:if test="not(position()=last())">
						<span class="t-minus">
						<span class="icon-open" node="icon"></span>
						<!--　
						<span class="icon-open" node="icon"></span>
					　　--><xsl:value-of select="$temp" />
						</span>
					</xsl:if>
					<!--
						<img src="../images/menu/icon_open.gif" align="absMiddle"
						node="icon" />
					-->
			</A>

			<UL>
				<xsl:if test="not(position()=last())">
					<xsl:attribute name="class">collapsed-1</xsl:attribute>
				</xsl:if>
				<xsl:variable name="topicsNum" select="count(TOPICS)" />
				<xsl:for-each select="TOPIC">
					<LI class="L22">
						<xsl:attribute name="id">
					       	<xsl:value-of select="ID" />
					    </xsl:attribute>
						<A ondrag="return false;" href="#@" hidefocus="true">
							<xsl:attribute name="title"><xsl:value-of select="TITLE" /></xsl:attribute>
							<xsl:attribute name="ONCLICK">
							if(genId.current){
							    document.getElementById(genId.current).className=document.getElementById(genId.current).className.replace(" ctp-leftmenu-visited","");												   
							    }
						 	    var selected= this.firstChild;
								selected.className+=" ctp-leftmenu-visited";
								if(!selected.id){
							    selected.id="L"+(genId.L_node++).toString();
							    genId.current=selected.id;
								}else{
								genId.current=selected.id;
								}
							<xsl:value-of select="URLT" />
					        </xsl:attribute>					        
							<xsl:if test="position()=last()">
								<xsl:if test="$topicsNum=0">
									<span class="line2">　
										<span class="icon-fn">　
										</span>
										<span class="bg_color"><xsl:value-of select="TITLE" /></span>
									</span>
								</xsl:if>
								<xsl:if test="$topicsNum!=0">
									<span class="line3">　
										<span class="icon-fn">　
										</span>
										<span class="bg_color"><xsl:value-of select="TITLE" /></span>
									</span>
								</xsl:if>
							</xsl:if>
							<xsl:if test="not(position()=last())">
								<span class="line3">　
									<span class="icon-fn">　
									</span>
									<span class="bg_color"><xsl:value-of select="TITLE" /></span>
								</span>
							</xsl:if>
						</A>
					</LI>
				</xsl:for-each>
				<xsl:if test="TOPICS">
					<xsl:apply-templates select="TOPICS" mode="childrenmode" />
				</xsl:if>
			</UL>
		</LI>
	</xsl:template>
</xsl:stylesheet>